/*jslint node:true*/
'use strict';
var fs = require('fs');

fs.readFile('input.txt', function (err, data) {
    if (err) {
        return console.error(err);
    }
    console.log("异步读取:" + data.toString());
    fs.writeFile('output.txt', data, function (err) {
        if (err) {
            return console.error(err);
        }
        console.log("异步写入成功");
    });
});

fs.stat('input.txt', function (err, stat) {
    if (err) {
        return console.error(err);
    }
    console.log(stat);
    console.log('isFile:' + stat.isFile());
    console.log('isDirectory:' + stat.isDirectory());
    console.log('isBlockDevice:' + stat.isBlockDevice());
    console.log('isCharacterDevice:' + stat.isCharacterDevice());
    console.log('isSymbolicLink:' + stat.isSymbolicLink());
    console.log('isFIFO:' + stat.isFIFO());
    console.log('isSocket:' + stat.isSocket());
});

var data = fs.readFileSync('input.txt');
console.log('同步读取:' + data.toString());
console.log("程序执行完毕");